import 'package:trollee/app/components/dialog/app_alert_dialog.dart';
import 'package:trollee/app/core/core.dart';
import 'package:trollee/app/core/mixins/http_request_auto_dispose_mixin.dart';
import 'package:trollee/app/modules/home/home/states.dart';
import 'package:trollee/app/modules/image_clip/image_clip.dart';
import 'package:trollee/app/routes/app_pages.dart';

class HomeController extends GetxController with HttpRequestAutoDisposeMixin {
  final HomeStates states = HomeStates();

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    checkVersion();
  }


  /// 检查新版本
  checkVersion() async {
    // final result = await BaseApi.getLastVersionInfo().executeAutoDispose(this);
    // result
    //   ..onSuccess((result) {
    //
    //   })
    //   ..onError((result) {})
    //   ..onCancel((result) {});
  }

  /// 显示更新弹窗
  showDialog() {
    AppLogger.devLog(UserManager.getToken().toString());
    AppAlertDialog.show(
        title: 'update_prompt'.tr,
        cancelText: 'close'.tr,
        content: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text("高亮内容",style: TextStyle(
              color: AppColors.green,
              fontSize: AppDimens.sp16
            )),
            AppGaps.vGap4,
            SizedBox(
              height: AppDimens.dp200,
                child: const SingleChildScrollView(
                  child: Text("更新内容\nhello\nhell\n ehgre\nhuwh"
                      "eufhu\none\none"),
                ))
          ],
        ));
  }

  goPush() {
    // Get.toNamed(AppRoutes.shoppingCartMonitoring);
    Get.to(const ImageClipPage());
  }

  goNews() {
    Get.toNamed(AppRoutes.news);
  }

  // 个人中心
  goProfile() {
    Get.toNamed(AppRoutes.profile);
  }



}
